package org.spring.cloud.service.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.spring.cloud.manager.UserManager;
import org.spring.cloud.model.UserModel;
import org.spring.cloud.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/user")
public class UserServiceImpl implements UserService{

	@Autowired
	private UserManager userManager;
	@Autowired
	private RedisTemplate<String, Object> redisTemplate;
	
	public String say() {
		return "say";
	}
	
	@Override
	public Object queryAll() {
		List<UserModel> selectAll = this.userManager.queryAll();
		System.out.println(selectAll);
		this.redisTemplate.opsForValue().set("abc", 99999);
		Long leftPushAll = this.redisTemplate.opsForList().leftPushAll("adc", selectAll);
		System.out.println(leftPushAll);
		return selectAll;
	}
	
	@Override
	public Object getIp() {
		Map<String,String> dataMap = new HashMap<>();
		dataMap.put("IP", "localhost");
		dataMap.put("PORT", "7003");
		dataMap.put("REMARK", "测试7003");
		return dataMap;
	}
	
}
